#include<bits/stdc++.h>
using namespace std;
random_device seed;
mt19937 mt(seed());
int main(){
    int n = mt()%1000000 + 1;
    cout<<n<<'\n';
    for(int i = 2;i<=n;i++){
        cout<<i<<' '<<mt()%(i - 1) + 1<<'\n';
    }
}